package cn.itcast.demo.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Arrays;
import java.util.List;

/**
 * @author 虎哥
 */
@Controller
public class HelloController {

    @GetMapping("hello")
    public String toView(Model model){
        // InternalResourceViewResolver --> prefix + viewName + suffix
        //      prefix:  /WEB-INF/views
        //      suffix: .jsp

        String msg = "hello, spring boot!";
        model.addAttribute("msg", msg);

        List<String> list = Arrays.asList("zhanghuyi", "liudehua", "huge", "wuyanzu");
        model.addAttribute("list", list);

        // Thymeleaf 视图去哪里寻找？
        return "hello";
    }
}
